<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/views/include/taglib.jsp" %>

<!DOCTYPE html>
<!--[if IE 8]> <html lang="zh" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="zh" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
	<title>${fns:getConfig('productName')} | 报表设置</title>
    <meta name="decorator" content="form"/>

</head>
<body style="background: white;">
<div class="form-body">
	<form:form id="inputForm" modelAttribute="report" action="${ctx}/report/report/report/save" method="post" class="form-horizontal" cssStyle="padding: 5px;">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>

		<table class="table table-striped table-bordered table-hover">
			<tbody>
				<tr>
					<td class="active" style="width: 15%;"><label class="pull-right">报表唯一ID,由接口调用方传入：</label></td>
					<td style="width: 35%;">
						<form:input path="uid" htmlEscape="false" maxlength="128" class="form-control "/>
					</td>
					<td class="active" style="width: 15%;"><label class="pull-right"><span style="color: #E7505A;"> * </span>报表分类id：</label></td>
					<td style="width: 35%;">
						<form:input path="categoryId" htmlEscape="false" maxlength="11" class="form-control required"/>
					</td>
				</tr>
				<tr>
					<td class="active" style="width: 15%;"><label class="pull-right"><span style="color: #E7505A;"> * </span>数据源ID：</label></td>
					<td style="width: 35%;">
						<form:input path="dsId" htmlEscape="false" maxlength="11" class="form-control required"/>
					</td>
					<td class="active" style="width: 15%;"><label class="pull-right"><span style="color: #E7505A;"> * </span>报表名称：</label></td>
					<td style="width: 35%;">
						<form:input path="name" htmlEscape="false" maxlength="50" class="form-control required"/>
					</td>
				</tr>
				<tr>
					<td class="active" style="width: 15%;"><label class="pull-right"><span style="color: #E7505A;"> * </span>报表SQL语句：</label></td>
					<td style="width: 35%;">
						<form:input path="sqlText" htmlEscape="false" class="form-control required"/>
					</td>
					<td class="active" style="width: 15%;"><label class="pull-right"><span style="color: #E7505A;"> * </span>报表列集合元数据(JSON格式)：</label></td>
					<td style="width: 35%;">
						<form:input path="metaColumns" htmlEscape="false" class="form-control required"/>
					</td>
				</tr>
				<tr>
					<td class="active" style="width: 15%;"><label class="pull-right"><span style="color: #E7505A;"> * </span>查询条件列属性集合(JSON格式)：</label></td>
					<td style="width: 35%;">
						<form:input path="queryParams" htmlEscape="false" class="form-control required"/>
					</td>
					<td class="active" style="width: 15%;"><label class="pull-right"><span style="color: #E7505A;"> * </span>报表配置选项(JSON格式)：</label></td>
					<td style="width: 35%;">
						<form:input path="options" htmlEscape="false" class="form-control required"/>
					</td>
				</tr>
				<tr>
					<td class="active" style="width: 15%;"><label class="pull-right"><span style="color: #E7505A;"> * </span>报表状态（1表示锁定，0表示编辑)：</label></td>
					<td style="width: 35%;">
						<form:input path="status" htmlEscape="false" maxlength="11" class="form-control required"/>
					</td>
					<td class="active" style="width: 15%;"><label class="pull-right"><span style="color: #E7505A;"> * </span>报表节点在其父节点中的顺序：</label></td>
					<td style="width: 35%;">
						<form:input path="sequence" htmlEscape="false" maxlength="11" class="form-control required"/>
					</td>
				</tr>
				<tr>
					<td class="active" style="width: 15%;"><label class="pull-right"><span style="color: #E7505A;"> * </span>说明备注：</label></td>
					<td style="width: 35%;">
						<form:input path="comment" htmlEscape="false" maxlength="500" class="form-control required"/>
					</td>
					<td class="active" style="width: 15%;"><label class="pull-right"><span style="color: #E7505A;"> * </span>创建用户：</label></td>
					<td style="width: 35%;">
						<form:input path="createUser" htmlEscape="false" maxlength="50" class="form-control required"/>
					</td>
				</tr>
				<tr>
					<td class="active" style="width: 15%;"><label class="pull-right"><span style="color: #E7505A;"> * </span>记录创建时间：</label></td>
					<td style="width: 35%;">
						<input id="gmtCreated" name="gmtCreated" type="text" maxlength="20" class="laydate-icon form-control layer-date required"
							value="<fmt:formatDate value="${report.gmtCreated}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
					</td>
					<td class="active" style="width: 15%;"><label class="pull-right"><span style="color: #E7505A;"> * </span>记录修改时间：</label></td>
					<td style="width: 35%;">
						<input id="gmtModified" name="gmtModified" type="text" maxlength="20" class="laydate-icon form-control layer-date required"
							value="<fmt:formatDate value="${report.gmtModified}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
					</td>
				</tr>
			</tbody>
		</table>
	</form:form>
</div>

<%@include file="/views/include/foot.jsp" %>
<script type="text/javascript">
	var validateForm;
	function doSubmit(){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
	  if(validateForm.form()){
		  $("#inputForm").submit();
		  return true;
	  }

	  return false;
	}

	$(document).ready(function() {
		validateForm = $("#inputForm").validate({
			errorElement: 'span',
            errorClass: 'help-inline border-red font-red',
            focusInvalid: false,
            errorContainer: "#messageBox",

			submitHandler: function(form){
				loading('正在提交，请稍等...');
				form.submit();
			},

			errorPlacement: function(error, element) {
				$("#messageBox").text("输入有误，请先更正。");
				if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
					error.appendTo(element.parent().parent());
				} else {
					error.insertAfter(element);
				}
			}
		});

		laydate({
			elem: '#gmtCreated', // 目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
			event: 'focus' // 响应事件。如果没有传入event，则按照默认的click
		});
		laydate({
			elem: '#gmtModified', // 目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
			event: 'focus' // 响应事件。如果没有传入event，则按照默认的click
		});
	});
</script>
</body>
</html>